import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

Vue.config.productionTip = false

function render() {
  return new Vue({
    router,
    store,
    render: h => h(App)
  }).$mount('#app')
}

// 单例模式：子应用生命周期改造
if (window.__POWERED_BY_WUJIE__) {
  let instance;
  window.__WUJIE_MOUNT = () => {
    instance = render();
  };
  window.__WUJIE_UNMOUNT = () => {
    instance.unmount && instance.unmount();
  };
} else {
  render();
}
